package me.liekkas.notify.email;


import me.liekkas.notify.enums.LanguageEnum;

public enum EmailTemplateEnum implements IEmailTemplate {

    邮箱注册激活验证("en/email-bind.ftl", "chs/email-bind.ftl", "cht/email-bind.ftl") {
        @Override
        public String toTemplateString(LanguageEnum lang) {
            return chooseTemplate(lang, this);
        }
    },
    审核状态通知("en/email-audit-status.ftl", "chs/email-audit-status.ftl", "cht/email-audit-status.ftl") {
        @Override
        public String toTemplateString(LanguageEnum lang) {
            return chooseTemplate(lang, this);
        }
    },
    订单已确认("en/email-order-status.ftl", "chs/email-order-status.ftl", "cht/email-order-status.ftl") {
        @Override
        public String toTemplateString(LanguageEnum lang) {
            return chooseTemplate(lang, this);
        }
    };

    private String templateEn;
    private String templateChs;
    private String templateCht;

    EmailTemplateEnum(String templateEn, String templateChs, String templateCht) {
        this.templateEn = templateEn;
        this.templateChs = templateChs;
        this.templateCht = templateCht;
    }

    private static String chooseTemplate(LanguageEnum lang, EmailTemplateEnum et) {
        String tpl = null;
        switch (lang) {
            case EN:
                tpl = et.getTemplateEn();
                break;
            case CHS:
                tpl = et.getTemplateChs();
                break;
            case CHT:
                tpl = et.getTemplateCht();
                break;
            default:
                break;
        }

        return tpl;
    }

    public String getTemplateEn() {
        return templateEn;
    }

    public String getTemplateChs() {
        return templateChs;
    }

    public String getTemplateCht() {
        return templateCht;
    }
}
